// import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
//
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:get/get.dart';
//
//
// class CommonLargeTextField extends StatefulWidget {
//   final int? maxLength;
//   final MaxLengthEnforcement? maxLengthEnforcement;
//   final String? hintText;
//   final bool readOnly;
//   final bool autofocus;
//   final TextStyle? style;
//   final TextStyle? hintStyle;
//   final TextEditingController controller;
//   final FocusNode? focusNode;
//   final void Function(String)? onChanged;
//   final void Function(String)? onSubmitted;
//   final TextInputAction? textInputAction;
//   final Decoration? decoration;
//   final EdgeInsetsGeometry? padding;
//   final int? maxLines;
//   final int? minLines;
//   final bool showCounter;
//   final Color? textColor;
//   final Color? hintColor;
//
//   const CommonLargeTextField({
//     super.key,
//     this.maxLength,
//     required this.controller,
//     this.focusNode,
//     this.style,
//     this.hintStyle,
//     this.autofocus = false,
//     this.readOnly = false,
//     this.maxLengthEnforcement,
//     this.hintText,
//     this.textInputAction,
//     this.onChanged,
//     this.onSubmitted,
//     this.decoration,
//     this.padding,
//     this.maxLines,
//     this.minLines,
//     this.showCounter = true,
//     this.textColor,
//     this.hintColor,
//   });
//
//   @override
//   State<CommonLargeTextField> createState() => _CommonLargeTextFieldState();
// }
//
// class _CommonLargeTextFieldState extends State<CommonLargeTextField> {
//   List<TextInputFormatter> list = [];
//   late FocusNode _focusNode;
//
//   int textCount = 0;
//
//   @override
//   void initState() {
//     super.initState();
//     list.clear();
//     _focusNode = widget.focusNode ?? FocusNode();
//     widget.controller.addListener(addListenerTextController);
//   }
//
//   @override
//   void dispose() {
//     super.dispose();
//     widget.controller.removeListener(addListenerTextController);
//     if (widget.focusNode == null) {
//       _focusNode.dispose();
//     }
//   }
//
//   addListenerTextController() {
//     if (mounted) {
//       setState(() {});
//     }
//   }
//
//   @override
//   Widget build(BuildContext context) {
//     return Container(
//       padding: widget.padding ??
//           EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.w)
//               .copyWith(bottom: 0),
//       decoration: widget.decoration,
//       child: Column(
//         children: [
//           TextField(
//             style: widget.style ??
//                 TextStyle(
//                   color: widget.textColor ?? AppColor.color282828,
//                   fontSize: 12.sp,
//                 ),
//             textAlignVertical: TextAlignVertical.center,
//             maxLines: widget.maxLines ?? 4,
//             minLines: widget.minLines ?? 4,
//             textInputAction: widget.textInputAction,
//             readOnly: widget.readOnly,
//             maxLength: widget.maxLength,
//             focusNode: _focusNode,
//             onChanged: widget.onChanged,
//             onSubmitted: (text) {
//               widget.onSubmitted?.call(text);
//             },
//             autofocus: widget.autofocus,
//             inputFormatters: list,
//             maxLengthEnforcement:
//                 widget.maxLengthEnforcement ?? MaxLengthEnforcement.enforced,
//             buildCounter: (context,
//                 {required currentLength, maxLength, required bool isFocused}) {
//               if (widget.maxLength != null &&
//                   currentLength >= (widget.maxLength ?? 0) &&
//                   isFocused) {
//                 LoadingUtils.showToast(LocaleKeys.maxCharactersReached.tr);
//               }
//               return null;
//             },
//             decoration: InputDecoration(
//               isCollapsed: true,
//               contentPadding: const EdgeInsets.all(0),
//               border: const OutlineInputBorder(borderSide: BorderSide.none),
//               errorBorder:
//                   const OutlineInputBorder(borderSide: BorderSide.none),
//               focusedBorder:
//                   const OutlineInputBorder(borderSide: BorderSide.none),
//               disabledBorder:
//                   const OutlineInputBorder(borderSide: BorderSide.none),
//               focusedErrorBorder:
//                   const OutlineInputBorder(borderSide: BorderSide.none),
//               enabledBorder:
//                   const OutlineInputBorder(borderSide: BorderSide.none),
//               labelStyle: const TextStyle(color: Colors.white),
//               hintText: widget.hintText,
//               hintStyle: widget.hintStyle ??
//                   TextStyle(
//                     color: widget.hintColor ?? AppColor.colorC7D1CE,
//                     fontSize: 12.sp,
//                   ),
//             ),
//             controller: widget.controller,
//           ),
//           // 4.verticalSpace,
//           Visibility(
//                   visible: widget.controller.text.characters.isNotEmpty &&
//                       widget.maxLength != null &&
//                       widget.showCounter,
//                   child: Row(
//                     mainAxisAlignment: MainAxisAlignment.end,
//                     children: [
//                       Text('${widget.controller.text.characters.length}',
//                           style: TextStyle(
//                             fontSize: 10.sp,
//                             color: AppColor.primary,
//                           )),
//                       Text('/${widget.maxLength}',
//                           style: TextStyle(
//                             fontSize: 10.sp,
//                             color: Colors.black38,
//                           )),
//                     ],
//                   ).marginOnly(top: 12.w))
//               .marginOnly(
//                   bottom: widget.controller.text.characters.isNotEmpty &&
//                           widget.maxLength != null &&
//                           widget.showCounter
//                       ? 4.w
//                       : 12.w)
//         ],
//       ),
//     );
//   }
// }
